package com.anlogic.sdk.ui.tests.utils;

import java.util.regex.Pattern;

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.Test;

public class BspAppTestUtils {

	public static void standaloneDr1m90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();

		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-0");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	
	public static void standaloneDr1m90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();

		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = emptyTitleShell[0].activate();
		activeShell.activate();
		activeShell.setFocus();
		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-0");
		bot.button("Finish").click();
		
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);
		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),101*1000);
		// === App Project ===
		
		addLib(bot);

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

	

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),30*1000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p),90 * 1000);
		}

	}
	
	public static  void addLib(SWTWorkbenchBot bot) {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"), 60 * 1000*3);
		bot.waitUntil(Conditions.widgetIsEnabled(bot.tree(0)), 60*2*1000);
		  // 等待 platform 树项可用
		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		activeShell2.setFocus();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),20000);
		bot.viewByTitle("Project Explorer").setFocus();
		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree(0)), 1000 * 60*2);
		
		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree(0).getTreeItem("platform")), 1000 * 60*2);
		
		bot.viewByTitle("Project Explorer").bot().tree(0).getTreeItem("platform").select();

		bot.viewByTitle("Project Explorer").bot().tree(0).getTreeItem("platform").doubleClick();

		//bot.waitUntil(Conditions.widgetIsEnabled(bot.tree().getTreeItem("platform").getNode("system.mss")), 1000 * 60);
		bot.viewByTitle("Project Explorer").bot().tree(0).getTreeItem("platform").getNode("system.mss").select();

		//bot.waitUntil(Conditions.widgetIsEnabled(bot.tree().getTreeItem("platform").getNode("system.mss")), 1000 * 60);
		bot.viewByTitle("Project Explorer").bot().tree(0).getTreeItem("platform").getNode("system.mss").doubleClick();

		bot.editorByTitle("system.mss").show();
		bot.editorByTitle("system.mss").setFocus();


	    bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Modify this BSP's Settings")),1000*60);
	    bot.button("Modify this BSP's Settings").click();
	    bot.tree(0).setFocus();
		bot.waitUntil(Conditions.widgetIsEnabled(bot.tree(0)), 60*2*1000);

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.tree().getTreeItem("Overview")),1000*60);
	    bot.tree().getTreeItem("Overview").select();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.tree().getTreeItem("Overview").getNode("library")),1000*60);
	    bot.tree().getTreeItem("Overview").getNode("library").select();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.table().getTableItem(8)),1000*60);
	    bot.table().getTableItem(8).toggleCheck();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.table().getTableItem(9)),1000*60);
	    bot.table().getTableItem(9).toggleCheck();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.table().getTableItem(7)),1000*60);
	    bot.table().getTableItem(7).toggleCheck();
	    
	    bot.waitUntil(Conditions.widgetIsEnabled(bot.table().getTableItem(4)),1000*60);
	    bot.table().getTableItem(4).toggleCheck();
	    
	    bot.waitUntil(Conditions.widgetIsEnabled(bot.table().getTableItem(10)),1000*60);
	    bot.table().getTableItem(10).toggleCheck();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.button("OK")),1000*60);
	    bot.button("OK").click();

	    bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),1000*60);
	    bot.viewByTitle("Project Explorer").show();
	}
    

	public static void standaloneDr1m90core164Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-1");
		
		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		bot.viewByTitle("Project Explorer").show();



		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),30*1000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	public static void standaloneDr1m90core164TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-1");
		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),15000);
		
		addLib(bot);
		// === App Project ===
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),30000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}

	public static void standaloneDr1m90core032Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-0");
		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),25000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),30000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
		
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}

	public static void standaloneDr1m90core032TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		
		SWTBotShell activeShell = emptyTitleShell[0].activate();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox(0).setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-0");
		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 60000);
		bot.button("Finish").click();

		

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),25000);
		// === App Project ===

		
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();
		emptyTitleShell1[0].setFocus();
		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		bot.button("Finish").click();


		bot.viewByTitle("Project Explorer").show();



		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	
	public static void standaloneDr1m90core132Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
	

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("32-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();

		bot.viewByTitle("Project Explorer").show();



		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
	
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	
	
	
	public static void standaloneDr1m90core132TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("apu-1");

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
			 bot.button("Finish").click();
			 bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(1).setSelection("32-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		bot.viewByTitle("Project Explorer").show();


		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}

	

	public static void standaloneDr1v90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
	

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];
		
		
		

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = emptyTitleShell[0].activate();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD102V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	public static void standaloneDr1v90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
	

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD102V20");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}

	

	public static void standalonePh1p35core032Test(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("PH1P35");
		bot.comboBox(1).setSelection("standalone");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
 		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		
		bot.button("Finish").click();
 		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}

	public static void freertosDr1m90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
 		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000); // 最长等 2 分钟


		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
 		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	
	public static void freertosDr1m90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}


	public static void freertosDr1m90core164Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 90 * 1000);
		}

	}
	
	public static void freertosDr1m90core164TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}

	

	public static void freertosDr1v90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD102V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();

		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);
		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	public static void freertosDr1v90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD102V20");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();

		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	

	public static void freertosPh1p35core032Test(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("PH1P35");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	
	public static void freertosPh1p35core032TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("PH1P35");
		bot.comboBox(1).setSelection("freertos");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}

	public static void rtthreadDr1m90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("apu-0");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	public static void rtthreadDr1m90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("apu-0");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}

	public static void rtthreadDr1m90core164Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	public static void rtthreadDr1m90core164TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
	

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD101V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("apu-1");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);
		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	



	
	public static void rtthreadDr1v90core064Test(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = emptyTitleShell[0].activate();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox(0).setSelection("AD102V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
	

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();

		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	public static void rtthreadDr1v90core064TestAndLib(SWTWorkbenchBot bot, String appName) throws Exception {
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("AD102V20");
		bot.comboBox(1).setSelection("rtthread");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===
		addLib(bot);

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();

		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();

		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000);

		bot.viewByTitle("Project Explorer").show();

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}


	
	public static void rtthreadPh1p35core032Test(SWTWorkbenchBot bot, String appName) throws Exception {

		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Platform Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);

	        // 如果菜单项已经可用，进行点击
	        bot.menu("File").menu("New").menu("Platform Project").click();
		final SWTBotShell[] emptyTitleShell = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		emptyTitleShell[0].activate();
		SWTBotShell activeShell = bot.activeShell();
		activeShell.activate();

		bot.textWithLabel("Project Name:").setText("platform");
		bot.comboBox().setSelection("PH1P35");
		bot.comboBox(1).setSelection("rtthread_nano");
		bot.comboBox(2).setSelection("rpu");
		bot.button("Finish").click();
		bot.waitUntil(Conditions.shellCloses(emptyTitleShell[0]), 120000);

		bot.viewByTitle("Project Explorer").show();
		SWTBotShell activeShell2 = bot.shell("data - FutureDynasty");
		activeShell2.activate();
		bot.waitUntil(Conditions.shellIsActive("data - FutureDynasty"),90000);
		// === App Project ===

		 bot.waitUntil(new DefaultCondition() {
	            @Override
	            public boolean test() throws Exception {
	                // 检查菜单是否可用
	                return bot.menu("File").menu("New").menu("Application Project").isEnabled();
	            }

	            @Override
	            public String getFailureMessage() {
	                return "Menu 'Platform Project' is not available or not enabled.";
	            }
	        },60*1000);
		bot.menu("File").menu("New").menu("Application Project").click();
		final SWTBotShell[] emptyTitleShell1 = new SWTBotShell[1];

		bot.waitUntil(new DefaultCondition() {
			public boolean test() {
				System.out.println("llctest");
				for (SWTBotShell shell : bot.shells()) {
					if ("".equals(shell.getText()) && shell.isOpen()) {
						emptyTitleShell1[0] = shell;
						return true;
					}
				}
				return false;
			}

			public String getFailureMessage() {
				return "no find shell";
			}
		}, 10000);

		//
		emptyTitleShell1[0].activate();
		emptyTitleShell1[0].setFocus();
		bot.textWithLabel("Project Name:").setText("app");
		bot.radio("C").click();
		// bot.comboBox(1).setSelection("64-bit");
		bot.comboBox(0).setSelection("platform");
		bot.list().select(appName);

		 bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")), 30000);
		 bot.button("Finish").click();
		 

		bot.viewByTitle("Project Explorer").show();
 		bot.waitUntil(Conditions.shellCloses(emptyTitleShell1[0]), 120000); // 最长等 2 分钟

		

		bot.waitUntil(Conditions.widgetIsEnabled(bot.viewByTitle("Project Explorer").bot().tree()),20000);
		bot.viewByTitle("Project Explorer").bot().tree().select("app").contextMenu("Build Project").click();
		SWTBotView consoleView = bot.viewByPartName("Console");
		consoleView.setFocus();
		if (consoleView.isActive()) {
			System.out.println(111);
			Pattern p = Pattern.compile(".*Build Finished. 0 errors.*", Pattern.DOTALL);
			
			bot.waitUntil(consoleTextMatches(consoleView, p), 60 * 1000);
		}

	}
	
	protected static ICondition consoleTextMatches(SWTBotView consoleView, Pattern pattern) {
		return new ConsoleTextMatches(consoleView, pattern);
	}

	static class ConsoleTextMatches implements ICondition {
		private final SWTBotView view;
		private Pattern pattern;

		public ConsoleTextMatches(SWTBotView view, Pattern pattern) {
			this.view = view;
			this.pattern = pattern;
		}

		@Override
		public boolean test() {
			if (view.isActive()) {
				String output = view.bot().styledText().getText();
				java.util.regex.Matcher m = pattern.matcher(output);
				return m.matches();
			}
			return false;
		}

		@Override
		public void init(SWTBot bot) {
		}

		@Override
		public String getFailureMessage() {
			return "build fail";
		}
	}

}
